package com.jeesite.modules.dataScreen.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Objects;

/**
 * 事件类型枚举
 *
 * @author machenzhi
 * since 2023/12/5 11:49
 * @version 1.0
 */
@Getter
@AllArgsConstructor
public enum SourceSystemCodeEnum {

    TRACK_CROWD("sys_code_gddkl", "轨道大客流智处"),
    FLOOD_DISPOSAL("sys_code_dtnl", "地铁内涝处置"),
    HAZARD_CHECK("sys_code_dlwhyswbc", "首路危货运输“五必查”"),
    OVERLIMIT_TRUCK("sys_code_hccxwf", "货车超限违法行为处置"),
    ROAD_BLOCKAGE("sys_code_glzd", "公路阻断事件处置"),
    WATERWAY_EMERGENCY("sys_code_hdyx", "航道运行应急响应"),
    PIER_CROWD("sys_code_mtdkl", "码头大客流处置"),
    HIGHWAY_RESUE("sys_code_gsgljy", "高速公路救援"),
    STATION_CAB_EVASION("sys_code_hczdkl", "火车站大客流出租汽车应急疏运"),
    HAZARD_VEHICLE_SPEED("sys_code_whysclcs", "危货运输车辆超速报警核警处置"),
    BUS_HOTLINE("sys_code_gjkfrx", "公交客服热线处置"),
    RAILWAY_SAFETY_HOTLINE("sys_code_tlaqzz", "铁路沿线安全隐患整治"),
    AIRPORT_SERVICE_HOTLINE("sys_code_jbjcaqcz", "江北机场净空安全协同处置"),
    POSTAL_SUPPORT_HOTLINE("sys_code_yzkdmdcz", "邮政快递重点矛盾纠纷处置"),

    ;

    private final String code;

    private final String text;


    public static SourceSystemCodeEnum getEnum(String code) {
        return Arrays.stream(SourceSystemCodeEnum.values()).filter(x -> Objects.equals(x.getCode(), code)).findFirst().orElse(null);
    }

    public static String getText(String code) {
        SourceSystemCodeEnum e = getEnum(code);
        return Objects.nonNull(e) ? e.getText() : null;
    }
}
